<?php
/**
 * This file is part of webman.
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the MIT-LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @author    walkor<walkor@workerman.net>
 * @copyright walkor<walkor@workerman.net>
 * @link      http://www.workerman.net/
 * @license   http://www.opensource.org/licenses/mit-license.php MIT License
 */

global $argv;

return [
    // File update detection and automatic reload
    'monitor' => [
        'handler' => process\Monitor::class,
        'reloadable' => false,
        'constructor' => [
            // Monitor these directories
            'monitorDir' => array_merge([
                app_path(),
                config_path(),
                base_path() . '/process',
                base_path() . '/support',
                base_path() . '/resource',
                base_path() . '/.env',
                base_path() . '/routes',
            ], glob(base_path() . '/plugin/*/app'), glob(base_path() . '/plugin/*/config'), glob(base_path() . '/plugin/*/api')),
            // Files with these suffixes will be monitored
            'monitorExtensions' => [
                'php', 'html', 'htm', 'env'
            ],
            'options' => [
                'enable_file_monitor' => !in_array('-d', $argv) && DIRECTORY_SEPARATOR === '/',
                'enable_memory_monitor' => DIRECTORY_SEPARATOR === '/',
            ]
        ]
    ],
    // IoTTask代理配置
    'IoTTask' => [
        'handler' => \process\IoTTask::class,
        'count' => cpu_count(),
    ],

    // ModbusTcpTask获取寄存器里面的数据
//    'modbus_tcp_task'  => [
//        'handler'  => process\ModbusTcpTask::class
//    ],

     //rpc进程
//    'rpc'  => [
//        'handler' => process\Rpc::class,
//        'listen'  => 'text://0.0.0.0:8888', // 这里用了text协议，也可以用frame或其它协议
//        'count'   => 8, // 可以设置多进程
//    ],

    // mqtt配置
//    'mqtt'=>[
//        'handler'=>process\Mqtt::class,
//        'count'=>8
//    ],
    //设备数据定时处理
    'ModbusTask'=>[
        'handler'=>process\ModbusTask::class,
        'count'=>8
    ],

    // http代理配置
//    'proxy' => [
//        'handler' => \process\Proxy::class,
//        'listen' => 'http://0.0.0.0:8989',
//        'count' => cpu_count(),
//        'reloadable' => false,
//    ],

//    'sip_server' => [
//        'handler' => process\SipServer::class,
//        'count' => cpu_count(),
//        'listen' =>  sprintf('%s://%s:%s', getenv('SIP_SERVER_PROTOCOL', 'tcp'), getenv('SIP_SERVER_HOST', '0.0.0.0'), getenv('SIP_SERVER_PORT', 15060)),
//        'constructor' => [
//            'config' => [
//                'realm' => getenv('SIP_SERVER_REALM', '3402000000'),
//                'serverSipDeviceId' => getenv('SIP_SERVER_SERVER_SIP_DEVICE_ID', '34020000002000000001'),
//                'gbVersion' =>getenv('SIP_SERVER_GB_VERSION', 'GB-2016'),
//                'authentication' => boolval(intval(getenv('SIP_SERVER_AUTHENTICATION', 0))),
//                'sipUsername' =>getenv('SIP_SERVER_SIP_USERNAME', 'admin'),
//                'sipPassword' => getenv('SIP_SERVER_SIP_PASSWORD', 'admin123!'),
//                'keepAliveInterval' => getenv('SIP_SERVER_KEEP_ALIVE_INTERVAL', 30),
//                'keepAliveLostNumber' => getenv('SIP_SERVER_KEEP_ALIVE_LOST_NUMBER', 3),
//                'encodingType' => getenv('SIP_SERVER_ENCODING_TYPE', 'UTF-8'), // GBK 或 UTF-8
//                'noAuthenticationRequiredClients' => []
//            ]
//        ]
//    ],

];
